package com.bowen.demo.demo002;

import java.util.Date;

/**
 * <h3>java-study</h3>
 * <p>测试代码</p>
 * @author : zhang.bw
 * @date : 2020-10-27 16:55
 **/
public class Test {

	public static void main(String[] args) {
		// 属性一致
		/*CarPo carPo1 = CarPo.builder().id(1)
				.brand("BC")
				.build();
		CarVo carVo1 = CarCovertBasic.INSTANCE.toConvertVo1(carPo1);
		System.out.println(carVo1);*/

		// 属性名称不一致
		/*CarPo carPo2 = CarPo.builder().id(1)
				.brand("BC").carName( "奔驰" )
				.build();
		CarVo carVo2 = CarCovertBasic.INSTANCE.toConvertVo2(carPo2);
		System.out.println(carVo2);*/

		// 集合类型转换
		/*List<CarPo> list1s = new ArrayList<>( );
		CarPo carPo3 = CarPo.builder().id(1)
				.brand("BC3").carName( "奔驰3" )
				.build();
		CarPo carPo4 = CarPo.builder().id(1)
				.brand("BC4").carName( "奔驰4" )
				.build();
		list1s.add( carPo3 );
		list1s.add( carPo4 );
		List<CarVo> carVo1s = CarCovertBasic.INSTANCE.toConvertVos(list1s);
		System.out.println(carVo1s);*/

		// 集合类型转换，属性不一致
		/*List<CarPo> list1s = new ArrayList<>( );
		CarPo carPo3 = CarPo.builder().id(1)
				.brand("BC3").carName( "奔驰3" ).createTime( new Date( ) )
				.build();
		CarPo carPo4 = CarPo.builder().id(1)
				.brand("BC4").carName( "奔驰4" ).createTime( new Date( ) )
				.build();
		list1s.add( carPo3 );
		list1s.add( carPo4 );
		List<CarVo> carVo1s = CarCovertBasic.INSTANCE.toConvertVos(list1s);
		System.out.println(carVo1s);*/

		// 多对一映射
		CarPo carPo = CarPo.builder().id(1)
				.brand("BC").carName( "奔驰" ).createTime( new Date(  ) )
				.build();
		AttributePo attributePo = AttributePo.builder().color( "red" ).price( 100000 ).build();
		CarBo carBo = CarCovertBasic.INSTANCE.toConvertBo(carPo,attributePo);
		System.out.println(carBo);

	}
}
